using TEngine;

namespace GameLogic
{
    public class ProcedureMain : ProcedureBase
    {
        protected override void OnInit(IFsm<IProcedureManager> procedureOwner)
        {
            base.OnInit(procedureOwner);
        }
        protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
        {
            base.OnEnter(procedureOwner);
            GameModule.UI.ShowUI<MainUI>();
            UnityEngine.Debug.Log("Start,,,,,,,,,,,,,,,,,,");

            SolarSystemModule.Instance.Init();
            GameModule.UI.ShowUI<DebugUI>();

            AddEvent(GameEventType.OnOnlineLobbyClicked, () =>
            {
                ChangeState<ProcedureOnlineLobby>(procedureOwner);
            });
            AddEvent(GameEventType.OnStartGame, () =>
            {
                ChangeState<ProcedureGaming>(procedureOwner);
            });
            AddEvent(GameEventType.OnBackClicked, () =>
            {
                GameModule.UI.CloseUI<ShipConfigUI>();
            });
        }

        protected override void OnLeave(IFsm<IProcedureManager> procedureOwner, bool isShutdown)
        {
            GameModule.UI.CloseUI<MainUI>();
            base.OnLeave(procedureOwner, isShutdown);
        }
    }
}
